<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<head>
  <title>Backup</title>

  <%@page language="java" contentType="text/html; charset=US-ASCII" pageEncoding="US-ASCII"%>
  
  <meta HTTP-EQUIV="refresh" CONTENT="<%= session.getMaxInactiveInterval() %>;URL=login.jsp" />
  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,300,700">
  <link rel="stylesheet" href="./css/font-awesome.min.css">
  <link rel="stylesheet" href="./js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.min.css">
  <link rel="stylesheet" href="./css/bootstrap.min.css">

  <!-- Plugin CSS -->
  <link rel="stylesheet" href="./js/plugins/morris/morris.css">
  <link rel="stylesheet" href="./js/plugins/icheck/skins/minimal/blue.css">
  <link rel="stylesheet" href="./js/plugins/select2/select2.css">
  <link rel="stylesheet" href="./js/plugins/fullcalendar/fullcalendar.css">
  <link rel="stylesheet" href="./js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.css">
  <link rel="stylesheet" href="./js/plugins/magnific/magnific-popup.css">
  

  <!-- App CSS -->
  <link rel="stylesheet" href="./css/target-admin.css">
  <link rel="stylesheet" href="./css/custom.css">
  
  <!-- Page CSS -->
  <link rel="stylesheet" href="./css/demos/ui-notifications.css">
  <script type="text/javascript" src="./js/libs/jquery-1.10.1.min.js"></script>
  <script>
  
  	$(document).ready(function(){
  		
			
  		$( "#ejecutarBackup" ).click(function() {
  			$( "form" ).submit();
  		});
  			
  		$( "#ejecutarRestore" ).click(function() {
  			$( "form" ).submit();
  		});
  		
	});
    
  </script>
  
</head>

<body>
<%
if(session.getAttribute("idUsuarioLogueado") == null){
    response.sendRedirect("login.jsp");
    return;
}
%>
<jsp:include page="/navbar.jsp"></jsp:include>
<%
	if(session.getAttribute("menuTipo").equals("admin")){
%>		 <%@include file="menuadmin.jsp" %>
<%	}else{
%> 
		<%@include file="menubasico.jsp" %>
<%		
    }
%>

  
<div class="container">
  <div class="content">
    <div class="content-container">
      
      <jsp:include page="mensajes.jsp"></jsp:include>
      
      <div>
       
       <div class="row">
		<div class="col-md-3 col-sm-5">
			<ul id="myTab" class="nav nav-pills nav-stacked">
            	<li class="active"><a href="#home-3" id="mnuBackup" data-toggle="tab"><i class="fa fa-arrow-circle-down"></i> &nbsp;&nbsp;Backup</a></li>
            </ul>
        </div> <!-- /.col -->
	  
	    <form action="backupServlet.do" method="post" >
	      <div class="col-md-9 col-sm-7">

           <div id="myTabContent" class="tab-content stacked-content">
             
             <div class="tab-pane fade in active" id="home-3">
               
               <p>Ingrese el prefijo que desea colocar al archivo de backup a generarse (m&aacute;x. 50 caracteres).</p>
               <p>El nombre del archivo quedar&aacute; conformado como &quot;prefijo_HHmmss_ddMMyyyy&quot;.</p>
				<br>
				<br>
				<div class="form-group">
				 <div class="col-sm-8">
                	<div class="input-group">
                 		<input class="form-control" id="appendedInputButton" name="prefijo" type="text" maxlength="50">
                  		<span class="input-group-btn">
                   			<a data-toggle="modal" href="#modalBackup"><button id="btnBackup" class="btn btn-secondary" type="button" onclick= "document.getElementById('accion').value = 'backup';">Ejecutar</button></a>
                  		</span>
                	</div>
               	</div>
               	</div>
             </div>

             <div class="tab-pane fade" id="profile-3">
               <p>La lista a continuaci&oacute;n muestra los backups generados y disponibles para su restauraci&oacute;n.</p>
               <p>Seleccione el que desea, luego haga click en &quot;Restaurar&quot;.</p>
               <br>
	              <div class="col-sm-8">
	               <div class="form-group">  
	                <label for="select-input">Seleccione el punto de restauraci&oacute;n:</label>
	                <select id="nombreArchivo" name="nombreArchivo" class="form-control">
	                	<c:forEach items="${archivos}" var="item">
        					<option>
                 				<c:out value="${item}" />
                			</option>
    					</c:forEach>
	                </select>
	               </div>
	               <a data-toggle="modal" href="#modalRestore"><button id="btnRestore" type="button" class="btn btn-secondary" onclick= "document.getElementById('accion').value = 'restore';">Restaurar</button></a>
	              </div>

             </div>
			
			<input type = "hidden" id = "accion" name = "accion" value="${accion}" />
			
           </div>

        </div> <!-- /.col -->
		</form>
       
       </div> <!-- /.row -->
       
      </div>

      <br>
      <br>

    </div> <!-- /.content-container -->
  </div> <!-- /.content -->
</div> <!-- /.container -->

<jsp:include page="/footer.jsp"></jsp:include>

  <script src="./js/libs/jquery-1.10.1.min.js"></script>
  <script src="./js/libs/jquery-ui-1.9.2.custom.min.js"></script>
  <script src="./js/libs/bootstrap.min.js"></script>

  <!--[if lt IE 9]>
  <script src="./js/libs/excanvas.compiled.js"></script>
  <![endif]-->
  
  <!-- Plugin JS -->
  <script src="./js/plugins/icheck/jquery.icheck.js"></script>
  <script src="./js/plugins/select2/select2.js"></script>
  <script src="./js/libs/raphael-2.1.2.min.js"></script>
  <script src="./js/plugins/morris/morris.min.js"></script>
  <script src="./js/plugins/sparkline/jquery.sparkline.min.js"></script>
  <script src="./js/plugins/nicescroll/jquery.nicescroll.min.js"></script>
  <script src="./js/plugins/fullcalendar/fullcalendar.min.js"></script>
  <script src="./js/plugins/magnific/jquery.magnific-popup.min.js"></script>
  <script src="./js/plugins/howl/howl.js"></script>

  <!-- App JS -->
  <script src="./js/target-admin.js"></script>
  
  <!-- Plugin JS -->
  <script src="./js/demos/dashboard.js"></script>
  <script src="./js/demos/calendar.js"></script>
  <script src="./js/demos/charts/morris/area.js"></script>
  <script src="./js/demos/charts/morris/donut.js"></script>
  <script src="./js/demos/ui-notifications.js"></script>

  
  <div id="modalBackup" class="modal modal-styled fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h2 class="modal-title">Confirmaci&oacute;n</h2>
      </div>
      <div class="modal-body">
        <p>Se va a realizar un backup completo de la base de datos en el servidor.</p>
        <p>&#191;Desea continuar?</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-tertiary" data-dismiss="modal">Cancelar</button>
        <button id="ejecutarBackup" type="button" class="btn btn-primary">Aceptar</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->




  <div id="modalRestore" class="modal modal-styled fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h2 class="modal-title">Confirmaci&oacute;n</h2>
      </div>
      <div class="modal-body">
        <p>Va a realizar una restauraci&oacute;n de la base de datos. La informaci&oacute;n actual se perder&aacute;, a menos que haya realizado un backup previamente.</p>
        <p>&#191;Desea continuar?</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-tertiary" data-dismiss="modal">Cancelar</button>
        <button id="ejecutarRestore" type="button" class="btn btn-primary">Aceptar</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

  
</body>
</html>